<?php

function listApplicantsNotif($receiver_id)
{
	$phql = "SELECT 
			 a.applicant_id,CONCAT(fname,' ',lname) as fullname,
			 n.id as notif_id,n.receiver_id,n.type,n.message,n.href,n.date_created,n.sender_id
			 FROM notif n 
			 LEFT JOIN applicant a ON a.applicant_id = n.receiver_id
			 WHERE n.receiver_id = {$receiver_id}
			 ORDER BY date_created DESC";
	return mysql_query($phql);
}


function insertNotif($receiver_id,$type,$message,$href)
{
	$phql = "INSERT INTO notif(receiver_id,type,message,href) 
			 VALUES({$receiver_id},'{$type}','{$message}','{$href}')";
	
	$pusher = new Pusher(PUSHER_APP_KEY, PUSHER_APP_SECRET, PUSHER_APP_ID);
	$pusher->trigger('applicant-notif', 'my-channel', $message);


	return mysql_query($phql);


}


?>